package com.kun.portal.webframe.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by Administrator on 2018/7/5.
 */
@Entity
@Table(
        name = "fbo_repair_plane_setting"
)
@DynamicUpdate
public class RepairPlaneSettingPo {
    @Id
    @GeneratedValue(
            generator = "id"
    )
    @GenericGenerator(
            name = "id",
            strategy = "uuid"
    )
    @Column(
            name = "id",
            length = 32,
            nullable = false
    )
    private String id;

    @Column(
            name = "flight"

    )

    private Boolean flight;
    @Column(
            name = "unit",
            length=32
    )
    private String unit;

    @ManyToOne(targetEntity = EquipmentPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "equipment_id",referencedColumnName ="id" )
    @JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class,property="@id")
    private EquipmentPo equipmentPo;

    @OneToOne(targetEntity = FlightInfoPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "flight_info_id",referencedColumnName ="flight_info_id" )
    @JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class,property="@id")
    private FlightInfoPo flightInfoPo;

    @Column(
            name = "overhaul_cycle"
    )
    private Integer OverhaulCycle;



    @Column(
            name = "leasted_overhaul_date"

    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date leastedOverhaulDate;
    @Column(
            name = "middle_cycle"

    )
    private Integer middleCycle;
    @Column(
            name = "middle_cycle_date"

    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date middleCycleDate;
    @Column(
            name = "minor_repair_cycle"

    )
    private Integer minorRepairCycle;
    @Column(
            name = "minor_repair_date"

    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date minorRepairDate;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Boolean getFlight() {
        return flight;
    }

    public void setFlight(Boolean flight) {
        this.flight = flight;
    }

    public EquipmentPo getEquipmentPo() {
        return equipmentPo;
    }

    public void setEquipmentPo(EquipmentPo equipmentPo) {
        this.equipmentPo = equipmentPo;
    }

    public FlightInfoPo getFlightInfoPo() {
        return flightInfoPo;
    }

    public void setFlightInfoPo(FlightInfoPo flightInfoPo) {
        this.flightInfoPo = flightInfoPo;
    }

    public Integer getOverhaulCycle() {
        return OverhaulCycle;
    }

    public void setOverhaulCycle(Integer overhaulCycle) {
        OverhaulCycle = overhaulCycle;
    }

    public Date getLeastedOverhaulDate() {
        return leastedOverhaulDate;
    }

    public void setLeastedOverhaulDate(Date leastedOverhaulDate) {
        this.leastedOverhaulDate = leastedOverhaulDate;
    }

    public Integer getMiddleCycle() {
        return middleCycle;
    }

    public void setMiddleCycle(Integer middleCycle) {
        this.middleCycle = middleCycle;
    }

    public Date getMiddleCycleDate() {
        return middleCycleDate;
    }

    public void setMiddleCycleDate(Date middleCycleDate) {
        this.middleCycleDate = middleCycleDate;
    }

    public Integer getMinorRepairCycle() {
        return minorRepairCycle;
    }

    public void setMinorRepairCycle(Integer minorRepairCycle) {
        this.minorRepairCycle = minorRepairCycle;
    }

    public Date getMinorRepairDate() {
        return minorRepairDate;
    }

    public void setMinorRepairDate(Date minorRepairDate) {
        this.minorRepairDate = minorRepairDate;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }
}
